#ifndef __CPPTUTORTCPSOCKETCLIENT_H__
#define __CPPTUTORTCPSOCKETCLIENT_H__

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifdef WIN32
// windows specific
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/errno.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <assert.h>
#include <fcntl.h>
#include <netdb.h>
#include <assert.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#endif

#define BACKLOG 20
#define RECEIVE_BUFF_SIZE 1024*5

class CcppTutorTCPSocketClient
{
	private:
		int iSin_size, iServerfd, iRet, iServerPort, iLogin, m_nReturnStatus, iOpenfd, iWriteNum;
		struct hostent * host;
		struct sockaddr_in server_addr;
		char sServerIp[20], sLogin[50], sPasswd[50], pLogName[100], sReceiveBuff[RECEIVE_BUFF_SIZE], sKeyBoardInput[RECEIVE_BUFF_SIZE], sPrintLogBuff[RECEIVE_BUFF_SIZE];
		const char *pLogin, *pPasswd;
        std::string m_strIPAddress, m_strPort, m_strClientLog;
	public:
		CcppTutorTCPSocketClient ();
        CcppTutorTCPSocketClient (std::string, std::string);
	   ~CcppTutorTCPSocketClient ();
		
		int ClientMain( );	
		int iWriteLogClient (char * pFileName, char * pLogBuff);
};

#endif //__CPPTUTORTCPSOCKETCLIENT_H__
